#include "startwindow.h"
#include "ui_startwindow.h"

StartWindow::StartWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::StartWindow)
{
    ui->setupUi(this);
    connect(ui->startBtn,SIGNAL(clicked()),this,SLOT(onStartBtnClicked()));
    connect(ui->quitBtn,SIGNAL(clicked()),this,SLOT(onQuitBtnClicked()));
    connect(ui->helpBtn,SIGNAL(clicked()),this,SLOT(onHelpBtnClicked()));
}

StartWindow::~StartWindow()
{
    delete ui;
}
void StartWindow::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    painter.drawPixmap(0,0,800,600,QPixmap(":/resources/resources/firstback.png"));
}
void StartWindow::onStartBtnClicked()
{
    game = new beaneater();
    game->show();
    this->close();
}

void StartWindow::onQuitBtnClicked()
{
    qApp->quit();
}

void StartWindow::onHelpBtnClicked()
{
    Help* helpWindow = new Help(this);
    helpWindow->exec();
}
